import triton
import triton.language as tl
import torch
import torch_npu
from .util import triton_helper_compile, compiled_kernel_list

from torch._inductor.runtime.triton_helpers import math as tl_math

# triton_poi_fused_mul_silu_8
@triton.jit
def fused_kernel6(in_out_ptr0, in_ptr0, xnumel, XBLOCK : tl.constexpr):
    xnumel = 73728
    xoffset = tl.program_id(0) * XBLOCK
    xindex = xoffset + tl.arange(0, XBLOCK)[:]
    xmask = tl.full([XBLOCK], True, tl.int1)
    x0 = xindex
    tmp0 = tl.load(in_out_ptr0 + (x0), None)
    tmp3 = tl.load(in_ptr0 + (x0), None)
    tmp1 = tl.sigmoid(tmp0)
    tmp2 = tmp0 * tmp1
    tmp4 = tmp2 * tmp3
    tl.store(in_out_ptr0 + (x0), tmp4, None)

def test_compile_for_fused_kernel6():
    signature = {0: '*fp32', 1: '*fp32', 2: 'i32'}

    constants = {
        "XBLOCK": 2048
    }
    triton_helper_compile(func=fused_kernel6, signature=signature, constants=constants)

compiled_kernel_list["fused_kernel6"] = test_compile_for_fused_kernel6